import { getSupplierInfo } from '../../../api/index'

Page({
  data: {
    detail: {}
  },
  async getDetail () {
    try {
      const { ResultSet } = await getSupplierInfo({ supplierId: this.data.supplierId })
      this.setData({ detail: ResultSet.userData })
    } catch (err) {
      wx.showToast({ title: err.message || err.ResultSet.errors, icon: 'none' })
    }
  },
  onLoad ({ id }) {
    this.setData({ supplierId: id })
    this.getDetail()
  }
})